/** @ingroup terminal
 * @file bell.h
 * @brief sound the bell
 *
 * @author cameris camerisdump@gmail.com
 */

#ifndef _BELL_H_
#define _BELL_H_

#include <stdint.h>

/** @name bell hardware settings
 * @{ */
#define BELL_PORT		PORTD
#define BELL_DDR		DDRD

#define BELL			PD7

#define BELL_TIMERA		TCCR2A
#define BELL_COM0		COM2A0
#define BELL_COM1		COM2A1
#define BELL_WGM0		WGM20
#define BELL_WGM1		WGM21

#define BELL_TIMERB		TCCR2B
#define BELL_WGM2		WGM22
#define BELL_CS0		CS20
#define BELL_CS1		CS21
#define BELL_CS2		CS22

#define BELL_OCR		OCR2A

#define BELL_INT_REG	TIMSK2
#define BELL_INT		TOIE2

#define BELL_INT_VECT	TIMER2_OVF_vect
/**@} */

#define BELL_BUF_SIZE 16

/** @brief tone */
enum tones { /* {{{ */
	BELL_NOSOUND = 0,
	BELL_C4,
	BELL_CS4,
	BELL_D4,
	BELL_DS4,
	BELL_E4,
	BELL_F4,
	BELL_FS4,
	BELL_G4,
	BELL_GS4,
	BELL_A4,
	BELL_AS4,
	BELL_B4,
	BELL_C5,
	BELL_CS5,
	BELL_D5,
	BELL_DS5,
	BELL_E5,
	BELL_F5,
	BELL_FS5,
	BELL_G5,
	BELL_GS5,
	BELL_A5,
	BELL_AS5,
	BELL_B5,
	BELL_C6,
	BELL_CS6,
	BELL_D6,
	BELL_DS6,
	BELL_E6,
	BELL_F6,
	BELL_FS6,
	BELL_G6,
	BELL_GS6,
	BELL_A6,
	BELL_AS6,
	BELL_B6,
	BELL_C7,
	BELL_MAXTONES,
}; /* }}} */

void bell_init(void);
void bell_add_tone(enum tones tone, uint_fast8_t duration);
void bell_enable(uint_fast8_t bool);
uint_fast8_t bell_get_enable(void);

#endif

/* vim:set foldmethod=marker: */
